package(default_visibility=["//visibility:public"])
load("@angular//:index.bzl", "ng_module")
load("@io_bazel_rules_sass//sass:sass.bzl", "sass_library")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_library", "ts_web_test")

ng_module(
  name = "overlay",
  srcs = glob(["**/*.ts"], exclude=["**/*.spec.ts"]),
  module_name = "@angular/cdk/overlay",
  deps = [
    "//src/cdk/bidi",
    "//src/cdk/coercion",
    "//src/cdk/keycodes",
    "//src/cdk/platform",
    "//src/cdk/portal",
    "//src/cdk/scrolling",
    "@rxjs",
  ],
  tsconfig = "//src/cdk:tsconfig-build.json",
)

# TODO(jelbourn): replace this w/ sass_library when it supports acting like a filegroup
filegroup(
  name = "overlay_scss_partials",
  srcs = glob(["**/_*.scss"]),
)

sass_library(
  name = "overlay_scss_lib",
  srcs = [":overlay_scss_partials"],
)

ts_library(
  name = "overlay_test_sources",
  testonly = 1,
  srcs = glob(["**/*.spec.ts"]),
  deps = [
    ":overlay",
    "//src/cdk/bidi",
    "//src/cdk/keycodes",
    "//src/cdk/platform",
    "//src/cdk/portal",
    "//src/cdk/scrolling",
    "//src/cdk/testing",
    "@rxjs",
    "@rxjs//operators",
  ],
  tsconfig = "//src/cdk:tsconfig-build.json",
)

ts_web_test(
  name = "unit_tests",
  # TODO(jelbourn): re-enable this when we can specify browser flags
  # in order to fix the window size.
  tags = ["manual"],
  bootstrap = [
    "//:web_test_bootstrap_scripts",
  ],

  # Do not sort
  deps = [
    "//:tslib_bundle",
    "//:angular_bundles",
    "//:angular_test_bundles",
    "//test:angular_test_init",
    ":overlay_test_sources",
  ],
)
